#ifndef ALARM_H
#define ALARM_H

#include <QObject>
#include <QHash>       // 包含 QHash 模板类定义
#include <QVariant>    // 包含 QVariant 类定义

class Alarm : public QObject
{
    Q_OBJECT
public:
    explicit Alarm(QObject *parent = nullptr);
    Q_INVOKABLE bool getAlarmParams();
    Q_INVOKABLE QHash<QString, QVariant> getSpeedParam();
    Q_INVOKABLE QHash<QString, QVariant> getWeightParam();
    Q_INVOKABLE QHash<QString, QVariant> getTemperatureParam();
    Q_INVOKABLE QHash<QString, QVariant> getPhParam();
    Q_INVOKABLE QHash<QString, QVariant> getConductivityParam();

    Q_INVOKABLE bool saveAlarmParam(const QString& param, const QString& value, const QString& name);
    Q_INVOKABLE bool saveAlarmAll(QHash<QString, QVariant> speed, QHash<QString, QVariant> weight, QHash<QString, QVariant> temperature, QHash<QString, QVariant> ph, QHash<QString, QVariant> conductivity);
    Q_INVOKABLE bool saveAlarm(QHash<QString, QVariant> param, const QString& name);

    Q_INVOKABLE QString getAlarmParam(const QString& param);
public:
    int checkAlarm(const QString& type, const QString desc, float value);

signals:

private:
    int checkAlarm(QHash<QString, QVariant>& temp, const QString &type, const QString desc, float value);
    QHash<QString, QVariant>& get(const QString& type);

private:
    QHash<QString, QVariant> m_speed;
    QHash<QString, QVariant> m_weight;
    QHash<QString, QVariant> m_ph;
    QHash<QString, QVariant> m_temperature;
    QHash<QString, QVariant> m_conductivity;
};

#endif // ALARM_H
